<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>威投票</title>
    <script src="__BUILDER_JS__/vue.min.js?__VERSION__"></script>
    <link  rel="stylesheet" type="text/css"  href="__BUILDER_CSS__/vant.css?__VERSION__" />
    <script src="__BUILDER_JS__/store.min.js?__VERSION__"></script>
    <script src="__BUILDER_JS__/request.js?__VERSION__"></script>
    <script src="__BUILDER_JS__/vant.min.js?__VERSION__"></script>
    <script src="__BUILDER_JS__/util.js?__VERSION__"></script>
    <script src="__BUILDER_JS__/axios.js?__VERSION__"></script>
    <script src="https://www.mainweb.cc/asset/js/jquery.min.js"></script>
</head>

<style>
    .qr_body{
        display: flex;
        flex-direction: column;
        justify-items: center;
        align-items: center;
    }
    .qr_icon_text{
        display: flex;
        flex-direction: column;
        justify-items: center;
        align-items: center;
        margin: 30% 0 0 0;
    }
    .qr_icon_text svg{
        margin-bottom: 5px;
    }
    .qr_icon_text div{
        font-weight: 100;
        font-size:24px;
        text-align: center;
    }
    .qr_btn{
        position:fixed;
        display: flex;
        flex-direction: column;
        justify-items: center;
        align-items: center;
        bottom:12%;
        font-size:15px;
        width:50%;
    }
    .qr_btn a{
        margin-top:28px;
        color:#3b3b73;
        text-align: center;
    }
    .van-button__text{
        font-size:16px !important;
    }
</style>
<style>
    .wrap{background: #fafafa;position: relative;}
    .bg{width: 160%;height: 100vw;background: linear-gradient(to bottom,#49b0ff 50%,#0a94ff 100%);border-radius: 50%;position: fixed;top: -30%;left: -30%;}
    .wrap .con{width: 100%;position: absolute;top: 0;left: 0;z-index: 99;padding: 16px;box-sizing: border-box;}

    .wrap .con .success_con{width: 100%;background: #fff;padding: 16px;box-sizing: border-box;border-radius: 6px;margin-top: 16px;position: relative;min-height: calc(100vh - 48px);box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.1);}
    .wrap .con .success_con::after{content: "";display: block;width: 90%;height: 12px;border-radius: 10px 10px 0px 0px;background: rgba(255, 255, 255, 0.5);position: absolute;top: -12px;left:50%;transform: translateX(-50%);}

    .wrap .con .success_con .icon_con{width: 100%;text-align: center;padding-top: 32px;}
    .wrap .con .success_con .icon_con svg{width: 100px;height: 100px;}
    .wrap .con .success_con .success_text{font-size: 16px;font-weight: 600;text-align: center;}

    .wrap .con .success_con .copy_view{width: 100%;margin-top: 32px;}
    .wrap .con .success_con .copy_view .copy_text{font-size: 15px;color: #666;text-align: center;margin-bottom: 4px;}
    .wrap .con .success_con .copy_view .copy_info{width: 100%;background: #f2f2f2;text-align: center;padding: 8px 0rpx;border-radius: 6px;}
    .wrap .con .success_con .copy_view .copy_info textarea{font-size: 14px;color: #999;line-height: 1em;display: block;width: 80%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;border: none;background: none;text-align: center;resize: none;height: auto;min-height: 14px;padding: 6px 0px;margin: 0 auto;pointer-events: none;}

    .btn_wrap{width: 100%;}
    .btn_wrap .flower_btn{width: 50%;display: flex;align-items: center;justify-content: center;background: #0592ff;border-radius: 6em;padding: 12px;margin: 32px auto 16px;border: 1px solid #0592ff;cursor: pointer;}
    .btn_wrap .flower_btn image{width: 19px;height:19px;margin-right: 8px;}
    .btn_wrap .flower_btn span{font-size: 14px;line-height: 1em;color: #fff;}
</style>
<body>
    <div class="wrap">
        <div class="bg"></div>
        <div class="con">
            <div class="success_con">
            <div class="icon_con">
                <svg t="1624862863691" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2998"><path d="M511.8 61.7c-246.4 0-448 201.6-448 448s201.6 448 448 448 448-201.6 448-448-201.6-448-448-448z" fill="#0592ff" p-id="2999" data-spm-anchor-id="a313x.7781069.0.i7" class=""></path><path d="M785.6 380.3s-343.5 336-346 331L290.3 559.6c-2.5-2.5 0-12.4 7.5-19.9l14.9-14.9c7.5-7.5 17.4-12.4 19.9-7.5l109.5 114.5 298.7-291.2c7.5-7.5 19.9-7.5 29.9 0l14.9 14.9c7.5 4.9 7.5 17.4 0 24.8z" fill="#FFFFFF" p-id="3000"></path></svg>
            </div>
            <div class="success_text">创建成功</div>
            <div class="copy_view">
                <div class="copy_text">请在PC端完善投票信息</div>
                <div class="copy_info">
                    <textarea name="page_url" id="copy_text" rows="1">{:url('login/Login/login','',true,true)}</textarea>
                </div>
            </div>
            <div class="btn_wrap">
                <div class="flower_btn copy_btn">
                    <span>复制链接</span>
                </div>
                <div class="flower_btn errbtn">
                    <span>绑定</span>
                </div>
            </div>
            </div>
        </div>
    </div>
    <div class="qr_body">
        
    </div>
    <script>
        var userInfo = {:json_encode($list,JSON_UNESCAPED_UNICODE)}; 
        var alpha_id = get_url_param_value('alpha_id');
        var url = "{:url('auth/Manager/updateManagerWxopenid','',true,true)}";
        var token_url = "{:url('api/Request/createJwt')}";
        var http = new Request({token_url:token_url});
        var data = {alpha_id:alpha_id,value:userInfo['wx_openid'],field:'wx_openid'};
        // var result = http.request('post',url,data);
        // alert(JSON.stringify(data));
        // if(result['code'] == 0){
        //     WeixinJSBridge.call('closeWindow');
        // }else{
        //     alert(result['msg']);
        // }
        if(alpha_id){
            updateStates();
        }else{
            $(".copy_btn").show();
            $(".errbtn").hide();
        }

        function updateStates(){
                    data = {alpha_id:alpha_id,value:userInfo['wx_openid'],field:'wx_openid'};
                    var res = http.request('post',url,data);
                    // alert(JSON.stringify(res));
                    vant.Notify({ type: 'success', message: res['msg'] });
                    if(res['code'] !== 0){
                        $(".copy_btn").hide();
                        $(".errbtn").show();
                    }else{
                        $(".copy_btn").show();
                        $(".errbtn").hide();
                    }
                  
                   
                }

        $(".copy_btn").on("click",function(){
            var copy = document.getElementById("copy_text");
            copy.select(); // 选中文本
            document.execCommand("copy"); // 执行浏览器复制命令
            vant.Notify({ type: 'success', message: "复制成功" });
        })
        $(".errbtn").on("click",function(){
            data = {alpha_id:alpha_id,value:userInfo['wx_openid'],field:'wx_openid'};
            var res = http.request('post',url,data);
            if(res['code'] !== 0){
                $(".copy_btn").hide();
                $(".errbtn").show();
            }else{
                $(".copy_btn").show();
                $(".errbtn").hide();
            }
            vant.Notify({ type: 'success', message: res['msg'] });
        })
    </script>
    <script>
         document.addEventListener('WeixinJSBridgeReady', function(){
        //关闭页面。
        //  WeixinJSBridge.call('closeWindow'); 

        document.getElementById("close").addEventListener("click",function(){
            WeixinJSBridge.call('closeWindow'); 
        })
        //隐藏右上角三个点按钮。
        WeixinJSBridge.call('hideOptionMenu'); 
        //显示右上角三个点按钮
        // WeixinJSBridge.call('showOptionMenu'); 
    
        //显示右下面工具栏
        // WeixinJSBridge.call('showToolbar'); 
        //隐藏右下面工具栏
        WeixinJSBridge.call('hideToolbar'); 

        }, false);

        WeixinJSBridge.call('closeWindow');
        WeixinJSBridge.call('hideOptionMenu'); 
        WeixinJSBridge.call('hideToolbar'); 
    </script>
</body>
</html>